package com.lmy.springCloud.controller;

import com.lmy.springCloud.service.AccountService;
import com.lmy.springCloud.utils.Result;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class AccountController {

    @Resource
    private AccountService accountService;

    @PostMapping("/account/reduce")
    public Result reduce(@RequestParam(value = "userId") Long userId, @RequestParam(value = "money") Integer money){
        accountService.reduce(userId, money);
        return Result.success(null, "扣减账户余额成功");
    }
}
